System.PropertyList = {}

System.PropertyList.readFile = function(path) {
	var doc = XML.readFile(path)

	function parseValue(v) {
		var vname = XML.name(v)
		if (vname == "string")
			return XML.innerText(v)
		else if (vname == "false")
			return false;
		else if (vname == "true")
			return true;
		else if (vname == "integer")
			return parseInt(XML.innerText(v));
		else if (vname == "array")
			return parseArray(v)
		else
			return null
	}
	
	function parseDictionary(root) {
		var items = XML.children(root)
		var result = {}
		for (var idx = 0; idx < items.length; idx += 2) {
			var k = items[idx];
			var v = items[idx + 1];
			var keyName = XML.innerText(k)
			result[keyName] = parseValue(v)
		}
	}
	
	function parseArray(root) {
		var items = XML.children(root)
		var result = []
		for (var idx = 0; idx < items.length; idx += 2) {
			result.push(parseValue(items[idx]))
		}
	}
	
	return parseValue(XML.children(doc)[0])
}
